const payAll = (type, data,paydata) => {
	return new Promise((resolve, reject) => {
		if (type == 'wx') {
			WeixinJSBridge.invoke('getBrandWCPayRequest', {
				appId: data.appId, // 公众号id
				timeStamp: data.timeStamp,
				nonceStr: data.nonceStr,
				package: data.packageVal,
				signType: data.signType,
				paySign: data.paySign,
			}, function(res) {
				resolve(res)
			})
		} else if (type == 'zfb') {
			//支付宝支付
			uni.getProvider({
				service: 'payment',
				success: function(res1) {
					let provider = res1.provider[0];
					uni.requestPayment({
						provider: provider,
						orderInfo: data.trade_no,
						success: function(res) {
							resolve(res)
							console.log('suc', res)
						},
						fail: function(err) {
							console.log('payerr', err)
						}
					})
				}
			})
		} else if (type == 'wxprogram') {
			//微信小程序支付
			uni.getProvider({
				service: 'payment',
				success: function(res1) {
					let provider = res1.provider[0];
					uni.requestPayment({
						provider: provider,
						...data,
						success: function(res) {
							resolve(res)
							console.log('suc', res)
						},
						fail: function(err) {
							console.log('payerr', err)
						}
					})
				}
			})
		} else if (type === 'nh') {
			
		}
	})

}

export default payAll